UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HrSGwzCwqsk84xiADHGHDlwIpiRRWnj9mQnNIwAeXYs=' 
WHERE 
  key_id = 'bfd34ce89aa8ec12fa94b86d91df768674319c14430424e7e87d1b6d2e99bc6c' 
  AND (
    token = 'HrSGwzCwqsk84xiADHGHDlwIpiRRWnj9mQnNIwAeXYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020