UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8xmicVi5TgpqHhl+t+kdLMwvtI8GIHumLn1blxTgNnI='
WHERE
key_id = '5b42999739c51615c41a97e2a59877b72a3997edc60a8ea721f634313ea570e2'
AND (
token = '8xmicVi5TgpqHhl+t+kdLMwvtI8GIHumLn1blxTgNnI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)