UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IkQKEdZaUQja4hxHgOO3TzdFHww5P6SkHGqyeq/N/Ts=' 
WHERE 
  key_id = '599e9f71a6eeec79d4e830e45613685439254912498911d2bdf1264aa49fc7d2' 
  AND (
    token = 'IkQKEdZaUQja4hxHgOO3TzdFHww5P6SkHGqyeq/N/Ts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033