UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xP/uLA0WoDxOGeFB18yjGV5FT/4V0rEbqwbETyU7VgM='
WHERE
key_id = '396211d68b991e45f1bc1677786a030be7ed55279f009300b97b9dcfe378eb9f'
AND (
token = 'xP/uLA0WoDxOGeFB18yjGV5FT/4V0rEbqwbETyU7VgM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)