UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WJx5ElJDHmqg84TFC8wjiBxjmh1fh2t9ZmqPQVk9pOw=' 
WHERE 
  key_id = '59a6186260edcfcecd0676eb5a2fdb95f3cdb0b28ad6beb45bc3cb2da191a67d' 
  AND (
    token = 'WJx5ElJDHmqg84TFC8wjiBxjmh1fh2t9ZmqPQVk9pOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023