UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'afZnMP6/X6hGjOSwjQoPJGSiRW4d3sNYiJD3MzaH7qA='
WHERE
key_id = 'c5c6e101ceed5294520e4e74cd4aa5602cd59f20aaaef8aa40f5d2ad9c774eff'
AND (
token = 'afZnMP6/X6hGjOSwjQoPJGSiRW4d3sNYiJD3MzaH7qA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)