UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gofI/wMQb/tZ66V7YRkgTY4fqFjdDg2xd4EMDeE7nBw=' 
WHERE 
  key_id = '881c9a1ccc03a4d20b90039026eba1af1b027c05072dc92df835af804ae6df35' 
  AND (
    token = 'gofI/wMQb/tZ66V7YRkgTY4fqFjdDg2xd4EMDeE7nBw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018