UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fhmJTXw4B6k6J/dsvEXV8zUFGU0cMdoRl0Ezw/CbanU=' 
WHERE 
  key_id = '1ab3a6c12d81783b07e5fc121f07f4d4dd9d9ea2870665eaffc132f96ccb32c0' 
  AND (
    token = 'fhmJTXw4B6k6J/dsvEXV8zUFGU0cMdoRl0Ezw/CbanU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034