UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T7p1HIrWBVmuzqFh8McaazqUyhkHyKeR6YF+mIjLX6I=' 
WHERE 
  key_id = '50d97688681dfa2770f5b49733390370deea735908fba8a89c94100276253da9' 
  AND (
    token = 'T7p1HIrWBVmuzqFh8McaazqUyhkHyKeR6YF+mIjLX6I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029