UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cuYDMX1ApJwFEZMKp7dCsOsEFK5w2haT8KvJu7UplTQ='
WHERE
key_id = 'd813609bf43f8f62388f54e72b57b3da3ac2e961c625129e2c4291b2504be742'
AND (
token = 'cuYDMX1ApJwFEZMKp7dCsOsEFK5w2haT8KvJu7UplTQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)