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