UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y8P5PSkUKeFLLPu4UbYQOpRdcyA27qA/WMNZzuC2dmg=' 
WHERE 
  key_id = 'c5cfdc5b202b2bbab221f8115bac4bd6154cf2a35d49956c0ae56430bc7bb284' 
  AND (
    token = 'Y8P5PSkUKeFLLPu4UbYQOpRdcyA27qA/WMNZzuC2dmg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036