UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lp8OMOW2UcS9aohkuLAgtaG/YW5rrSf0xcGHCXKg1Tw=' 
WHERE 
  key_id = '805b2307af064bc49d85f1b91b5d8a4e81fff259aab89f2654b08aaac2449479' 
  AND (
    token = 'lp8OMOW2UcS9aohkuLAgtaG/YW5rrSf0xcGHCXKg1Tw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00093