UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'je0StRBcGUdkLfP3THz3eypIE/btbutDYXvQFSNy7mY=' 
WHERE 
  key_id = '3cecff58f8d5bb2568d76d15d8f6738fc80375f30831484a5382ac3745f78e40' 
  AND (
    token = 'je0StRBcGUdkLfP3THz3eypIE/btbutDYXvQFSNy7mY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025