UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9GcaK0UKsOQuaraX0gP9VHbgvWj6j1s2joQLwEVqbh0='
WHERE
key_id = 'fc444d997c14a96301bb19d3ff3c0085198418eac05b498931a2a31cb05f762d'
AND (
token = '9GcaK0UKsOQuaraX0gP9VHbgvWj6j1s2joQLwEVqbh0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)