UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qtt/ESqM24Wg0ANDpBWEW38amI9KcsaMKpdVHZRHUWo=' 
WHERE 
  key_id = 'f2dab51b95b074472a8f9a4ce961c140d4a8dbe677b8cdaab03c2e337811ff30' 
  AND (
    token = 'Qtt/ESqM24Wg0ANDpBWEW38amI9KcsaMKpdVHZRHUWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035