UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8fxA5B8IP4UlVx9yJZJyUNdVB8qOqyjJrRf0UOkMI7Y='
WHERE
key_id = 'd770b8ccbc53b4ace0d1c9c1f55f42dde4860b7c004bc8f71a29e5e82603f511'
AND (
token = '8fxA5B8IP4UlVx9yJZJyUNdVB8qOqyjJrRf0UOkMI7Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)