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

Query time 0.00029