UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zo6KmaNCzGdpViTQbhDih7uVFBwBL8fcoluIvP6b8pA='
WHERE
key_id = '8c493b6ee8bca435135f34c336a2f522a801d92dd318064970510212da6e56f4'
AND (
token = 'Zo6KmaNCzGdpViTQbhDih7uVFBwBL8fcoluIvP6b8pA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)