UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zjR149DaGM78z9iuZuKiS0Azi2DoB2zDSrcaHYNNCis='
WHERE
key_id = 'd5fad1395a56ec5618af147e628515acb4170b323477c17da1c51bc3d6d06451'
AND (
token = 'zjR149DaGM78z9iuZuKiS0Azi2DoB2zDSrcaHYNNCis='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)