UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iIw+imSJU2ukfwV50GdGwUIKOaaJS5qMrf6uv/S1m5U='
WHERE
key_id = '7ca49317a412408a5c002664e4dee7b32fe9543342ca8a29bfe9f51c06d8143c'
AND (
token = 'iIw+imSJU2ukfwV50GdGwUIKOaaJS5qMrf6uv/S1m5U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)