UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k9MFYLCj3mEhqLS1ZNE1Ign15J5pVNotKn/c9KPook0='
WHERE
key_id = '9e30903937d1db010f10b9afe98ed5b4240a8664d512d5c40db0db6d3039e474'
AND (
token = 'k9MFYLCj3mEhqLS1ZNE1Ign15J5pVNotKn/c9KPook0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)