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

Query time 0.00036