UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vnbgO5I8m6NZIpWae33KgS7mp7JjgeyL0DWaoY8Yb7w='
WHERE
key_id = '7c845456c505963da24ce74930beee41ad8ca80ee371897bf18b51ac24424a1d'
AND (
token = 'vnbgO5I8m6NZIpWae33KgS7mp7JjgeyL0DWaoY8Yb7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)