UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6wXWYMaeeVB1N8GQFWzJWASRWIeB6itTo6hmL/cMmPM='
WHERE
key_id = 'a3ef30a8cb8eedbc7ea551979aa813dad6d2e99b6150d6384303ac79950a4bb6'
AND (
token = '6wXWYMaeeVB1N8GQFWzJWASRWIeB6itTo6hmL/cMmPM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)