UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Mci7kI6daaqqFmT6Mdf1yyDJh8434OGeNU6eRQorbzM='
WHERE
key_id = 'aae8c6e5a9b587054a641c7c24f05bccabe801afab25d7be6de3ee68866ec97f'
AND (
token = 'Mci7kI6daaqqFmT6Mdf1yyDJh8434OGeNU6eRQorbzM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)