UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KA/jWqRY0hy0QV0RC6erjVli2DA+zpurmLj02FWGim4=' 
WHERE 
  key_id = '8a06ca87f3f9dd3b3647cf8c6753e6e27ca5e1d688d97559f7c26496c104c402' 
  AND (
    token = 'KA/jWqRY0hy0QV0RC6erjVli2DA+zpurmLj02FWGim4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050