UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dglT3kY76lUCHiS9XyjAi2+ljEsV8qRUM/DGRaOzlj0='
WHERE
key_id = 'd23fac6a03e8bdfc7e7db195c17a884bf4ca828681b82e02da9515e130eac1ee'
AND (
token = 'dglT3kY76lUCHiS9XyjAi2+ljEsV8qRUM/DGRaOzlj0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)