UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'crTaHApXBIA9Ih2sE4bwRxaGivscuKsVe2a3yUM1wuo='
WHERE
key_id = '8935b0808675651c79d7e45b3be7acf892f41377acef5d81a07f88b56b2191b0'
AND (
token = 'crTaHApXBIA9Ih2sE4bwRxaGivscuKsVe2a3yUM1wuo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)