UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UTGhbij8sRe3Cbl3chkhQAr9zgFyVSes8T9efs54pyM='
WHERE
key_id = '0f8b75fbab015e277c4334a9ce495a6484695801493cd1912dbeca899624bdb2'
AND (
token = 'UTGhbij8sRe3Cbl3chkhQAr9zgFyVSes8T9efs54pyM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)