UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UzCejrWDKLYQoTpXkM3rU+9rG1MHLcdV8TMLm+nIRGs=' 
WHERE 
  key_id = 'f893af6069cec79cc16b4f08dcc53703770abe32157f6b7ad9f1ed5f6a232aa3' 
  AND (
    token = 'UzCejrWDKLYQoTpXkM3rU+9rG1MHLcdV8TMLm+nIRGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025