UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tuC72mibuz9FQ94cO7gAp3P1H+D0RVwtzw7v3z3Zb50='
WHERE
key_id = '1143c796309e2aabec79d04b4ba8fdc73370a102576509870e7b170450b5a4e7'
AND (
token = 'tuC72mibuz9FQ94cO7gAp3P1H+D0RVwtzw7v3z3Zb50='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)