UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W1AP1DaD2w3cm5lYvfKGfJKotX2mxsKIGAQjuBNjFOM='
WHERE
key_id = '0cabe3f8db4082a678f86782cb2c03fa333b371299c69c444a27754f24390957'
AND (
token = 'W1AP1DaD2w3cm5lYvfKGfJKotX2mxsKIGAQjuBNjFOM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)