UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UHUYhbuhmxG8DMyIzQ1bAB39TD+CSbJ82MhSCJ5hfio=' 
WHERE 
  key_id = '2c68160ff4cec13996b472ce4b1db8b8cc281673ce4235a0dbbdc8585df97fcc' 
  AND (
    token = 'UHUYhbuhmxG8DMyIzQ1bAB39TD+CSbJ82MhSCJ5hfio=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018