UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E9G2HrvaNu8Smq0OCfymTMXKpY+tYlKcfW96N/tC6+Y='
WHERE
key_id = 'aa97e59d89bbae025a4ff8e8ebe208ed9f63990a975c87725953afd0a441abef'
AND (
token = 'E9G2HrvaNu8Smq0OCfymTMXKpY+tYlKcfW96N/tC6+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)