UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hqt/eawXdAz1o2wItKBhndys6bc7Z8X8kBqa2yVpfdE='
WHERE
key_id = '9e70678c68a1f364b0a58632398e05c555b57bfbb8d922c664bb3fe01ec67fe8'
AND (
token = 'Hqt/eawXdAz1o2wItKBhndys6bc7Z8X8kBqa2yVpfdE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)