UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BBKXj88SGW1UE7tWMqOqyMOGdbQ+++TM5SGIlHhYnh0='
WHERE
key_id = 'be549a8a76c9954cc200cb8fb2fadd842017474c37168e98cd24ab0260f9490a'
AND (
token = 'BBKXj88SGW1UE7tWMqOqyMOGdbQ+++TM5SGIlHhYnh0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)