UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EjlIPd040PX0z48rhsduHh90QKOykK8gvlhFi9F+WjA='
WHERE
key_id = '6473f5a6ff8558706146041e635b1be5ca98a02a61b4f38ba2491aa744aecbb6'
AND (
token = 'EjlIPd040PX0z48rhsduHh90QKOykK8gvlhFi9F+WjA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)