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

Query time 0.00085