UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aAhuWYuENDwY0xZ5bMKT++GScIvzCZJ1GZUuPSYp6Xs=' 
WHERE 
  key_id = '44b5dbab9018eb616a56626576aed9cda8cb98c492f3494667c83a7017bec8cb' 
  AND (
    token = 'aAhuWYuENDwY0xZ5bMKT++GScIvzCZJ1GZUuPSYp6Xs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032