UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f2mfN/qRJwZekmZtrDMP+nmWuH9fLBSbz39/CBoxdzM='
WHERE
key_id = 'fd46848bfbc8472d48f88f71a45381d51bd6e6687296313942a8819883cbe947'
AND (
token = 'f2mfN/qRJwZekmZtrDMP+nmWuH9fLBSbz39/CBoxdzM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)