UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AOBCuXQcP7E34wqweJuM071t0TWylQkSCbTpxPCSs+w='
WHERE
key_id = 'a3cfde29c224cf8f8c034524ffcb68e737f5972ebf957e25b8873290841e5e96'
AND (
token = 'AOBCuXQcP7E34wqweJuM071t0TWylQkSCbTpxPCSs+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)