UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xG8AYTlZ9Zt0Wl5UnJq7J4mQxkMB2+fJn7waSgVqAjw='
WHERE
key_id = 'f77c9116183bcf500a93807208c7f5022f705064f47c14303c940643de6da3bd'
AND (
token = 'xG8AYTlZ9Zt0Wl5UnJq7J4mQxkMB2+fJn7waSgVqAjw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)