UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ECgoRZjKeNjEr0DD86Hk2VB4c/B+qvoJonVOpb2fMyk='
WHERE
key_id = '22e24d272bccc20a3a828a14f4b897e6d85e3b8a88e37732b8f7284d0d9fde77'
AND (
token = 'ECgoRZjKeNjEr0DD86Hk2VB4c/B+qvoJonVOpb2fMyk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)