UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3DNrrRhexMpRY8nHTeZzV0S1NMUY/EcEQ+TtQkayfAQ='
WHERE
key_id = 'e8b946d994ed1894476d0b5701556cb91f4270420bd6dd7e5c8a8f8931177ef6'
AND (
token = '3DNrrRhexMpRY8nHTeZzV0S1NMUY/EcEQ+TtQkayfAQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)