UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cusBw3XsKN/C44ic3+bm/l8f0vhS85VlaQRQlc0ENhc='
WHERE
key_id = 'c5594710761dc56be874fbdca7321f347f40ce798f8531a73274e45609743f22'
AND (
token = 'cusBw3XsKN/C44ic3+bm/l8f0vhS85VlaQRQlc0ENhc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)