UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w68t6jOSZanzuB5RBSvfrO9/TQvuN0r+GBDfuKX+GHA=' 
WHERE 
  key_id = 'af0f86ab982e0134241ff9b5c08bae8567b1d7629f29a4be109f1ddd714b611d' 
  AND (
    token = 'w68t6jOSZanzuB5RBSvfrO9/TQvuN0r+GBDfuKX+GHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017