UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dJJ/Oy07B51ON4VQofpauHwAUSE8z6lG2p8qIuxqya0='
WHERE
key_id = 'b691c4231f0b4693c1cbb19be659bd364ea7950d39e8ee4d423510e0de5d8924'
AND (
token = 'dJJ/Oy07B51ON4VQofpauHwAUSE8z6lG2p8qIuxqya0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)