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