UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6L3tQqPQtEKJBd0T0ffrp8L8A/S4byJrKIbcaP6LJC4='
WHERE
key_id = 'c6c0cb325f68c3339c027f637760b08cd8a7c52ab17876bd41597cb64298bdc9'
AND (
token = '6L3tQqPQtEKJBd0T0ffrp8L8A/S4byJrKIbcaP6LJC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)