UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rcoLVoVCL2NRii3sRSOfD8+Pc8U1cUi0zY643LRYVW4=' 
WHERE 
  key_id = '2de3c1df577df213bedfb391a74a4f6578d1a6a34e954facb9b1ad6540917d58' 
  AND (
    token = 'rcoLVoVCL2NRii3sRSOfD8+Pc8U1cUi0zY643LRYVW4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021