UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NeHj2uKyXAULJtyq4OlD0v5A0mdRaTw9nRw1KjKqiw0='
WHERE
key_id = '3a890eb2a377b023aa28aaeb666e25c1862d482df754c19acf869a2719331c34'
AND (
token = 'NeHj2uKyXAULJtyq4OlD0v5A0mdRaTw9nRw1KjKqiw0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)