UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p0g7yA/MlutoG5um8oujcumh4WhHnl7GF1c5uS/jrp0='
WHERE
key_id = '817161eec08aa3f22c3a6dd95d08f764c7b36af353333a20eb99401092f7245d'
AND (
token = 'p0g7yA/MlutoG5um8oujcumh4WhHnl7GF1c5uS/jrp0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)