UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tydyakYJ/qk8q/Xqx6edEiAUS4Fyhw20kL9anEB8wYs='
WHERE
key_id = '6363043ed7aca882079ce0b0eb94890df85ef491a2b5028f9d42221a77d2e5b3'
AND (
token = 'tydyakYJ/qk8q/Xqx6edEiAUS4Fyhw20kL9anEB8wYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)