UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9wLX6aNGJAtjburdSXlpj9dUFuNhp4gn+vFVaiOTiD8='
WHERE
key_id = 'b15b3efa2664192eba133a98f7e4416617a59b81fa383d321a5cbb0213859b6f'
AND (
token = '9wLX6aNGJAtjburdSXlpj9dUFuNhp4gn+vFVaiOTiD8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)