UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7rSm3fm3cduMCV31jume7tgxkbTuGpOA+Lq78Jc23JE=' 
WHERE 
  key_id = 'c5c7ae5aca6ab1be249dcc829c2bc773b65b607452d4401e2df3f4c2ee2191bd' 
  AND (
    token = '7rSm3fm3cduMCV31jume7tgxkbTuGpOA+Lq78Jc23JE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064