UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2J1Ep9U+ilCW0Upg4p2mfjVRoA7EN344V+Ey9RmfuRs=' 
WHERE 
  key_id = '154a6801fc14c092a0b7b1bf8f028f3b114a88c98fef78267fbe43d4ce89125c' 
  AND (
    token = '2J1Ep9U+ilCW0Upg4p2mfjVRoA7EN344V+Ey9RmfuRs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033